<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<div id="need_add" style="padding:10px 10px 10px 10px">
	<form id="needAddForm" method="post">
		<input type="hidden" name="id" value="${need.id }" />
		<input type="hidden" name="text" value="${need.name }" />
		<input type="hidden" name="isPon" value="${need.isPon }" />
		<table class="tm-tableAttr">
			<tr class="tm-tableAttrSub">
				<th colspan="14">设计需求</th>
			</tr>
			<tr>
				<th>设计编号</th>
				<td><input class="textbox" type="text" id="designNo"
					name="designNo"></input></td>
			</tr>
			<tr class="tm-tableAttrSub">
				<th colspan="14">设计需求描述</th>
			</tr>
			<tr>
				<th>需求规格描述方式</th>
				<td><input class="textbox" name="drs"></input></td>
			</tr>
			<c:if test="${need.isPon==0 }">
				<tr>
					<th>选择属性</th>
					<td><select class="combo .combo-text combo-arrow-hover"
						style="width:370px;" name="isRequired">
							<option value="">请选择</option>
							<option value="必选">必选</option>
							<option value="可选">可选</option>
							<option value="必选X填空">必选X填空</option>
							<option value="可选X填空">可选X填空</option>
							<option value="无关">无关</option>
							<option value="填空，并在三级列填入对应的接口库第二级">填空，并在三级列填入对应的接口库第二级</option>
							<option value="选择时在子表做子项选择">选择时在子表做子项选择</option>
							<option value="IPRAN、PON必选">IPRAN、PON必选</option>
							<option value="PON必选，其他可选">PON必选，其他可选</option>
							<option value="交流时必选，X填空">交流时必选，X填空</option>
	
					</select></td>
				</tr>
			</c:if>
			<c:if test="${need.isPon==1 }">
				<tr>
					<th>OLT/MSAN选择属性</th>
					<td><select class="combo .combo-text combo-arrow-hover"
						style="width:370px;" name="oltMsanPro">
							<option value="">请选择</option>
							<option value="必选">必选</option>
							<option value="可选">可选</option>
							<option value="必选X填空">必选X填空</option>
							<option value="可选X填空">可选X填空</option>
							<option value="无关">无关</option>
							<option value="必选（与MAC转发单选）">必选（与MAC转发单选）</option>
							<option value="MSAN必选，其它无关">MSAN必选，其它无关</option>
					</select></td>
				</tr>
				<tr>
					<th>ONU/MSAN选择属性</th>
					<td><select class="combo .combo-text combo-arrow-hover"
						style="width:370px;" name="onuMsanPro">
							<option value="">请选择</option>
							<option value="必选">必选</option>
							<option value="可选">可选</option>
							<option value="必选X填空">必选X填空</option>
							<option value="可选X填空">可选X填空</option>
							<option value="无关">无关</option>
							<option value="必选（与MAC转发单选）">必选（与MAC转发单选）</option>
							<option value="MSAN必选，其它无关">MSAN必选，其它无关</option>
							<option value="SFU可选，MDU必选">SFU可选，MDU必选</option>
							<option value="必选，不带交换芯片的SFU为可选">必选，不带交换芯片的SFU为可选</option>
					</select></td>
				</tr>
			</c:if>
			<tr class="tm-tableAttrSub">
				<th colspan="14">参数范围（规格）</th>
			</tr>
			<tr>
				<th>选择</th>
				<td><select class="combo .combo-text combo-arrow-hover"
					style="width:370px;" name="prChoose">
						<option value="">请选择</option>
						<option value="新增">新增</option>
				</select></td>
			</tr>
			<tr>
				<th>是否测试需求</th>
				<td><select class="combo .combo-text combo-arrow-hover"
					style="width:370px;" name="prIstest">
						<option value="">请选择</option>
						<option value="否">否</option>
						<option value="是">是</option>
				</select></td>
			</tr>
			<tr>
				<th>需求规格说明</th>
				<td><input class="textbox" name="prSpecification"></input></td>
			</tr>
			<tr>
				<th>功能说明</th>
				<td><input class="textbox" name="prFunction"></input></td>
			</tr>
			<tr class="tm-tableAttrSub">
				<th colspan="14"></th>
			</tr>
			<tr>
				<th>需求级别</th>
				<td><select class="combo .combo-text combo-arrow-hover"
					style="width:370px;" name="needDegree">
						<option value="">请选择</option>
						<option value="5">5</option>
						<option value="4">4</option>
						<option value="3">3</option>
						<option value="2">2</option>
						<option value="1">1</option>
				</select></td>
			</tr>
			<tr>
				<th>实现版本</th>
				<td><input class="textbox" name="impVersion"></input></td>
			</tr>
			<tr class="tm-tableAttrSub">
				<th colspan="14">系统联调需求符合度</th>
			</tr>
			<tr>
				<th>是否实现</th>
				<td><select class="combo .combo-text combo-arrow-hover"
					style="width:370px;" name="scIsimp">
						<option value="">请选择</option>
						<option value="是">是</option>
						<option value="否">否</option>
				</select></td>
			</tr>
			<tr>
				<th>备注</th>
				<td><input class="textbox" name="scRemarks"></input></td>
			</tr>
			<tr class="tm-tableAttrSub">
				<th colspan="14">系统测试需求符合度</th>
			</tr>
			<tr>
				<th>是否实现</th>
				<td><select class="combo .combo-text combo-arrow-hover"
					style="width:370px;" name="stIsimp">
						<option value="">请选择</option>
						<option value="是">是</option>
						<option value="否">否</option>
				</select></td>
			</tr>
			<tr>
				<th>备注</th>
				<td><input class="textbox" name="stRamarks"></input></td>
			</tr>
			<tr class="tm-tableAttrSub">
				<th colspan="14">物理架构</th>
			</tr>
		</table>
		<table>
			<tr>
				<th>MDU</th>
				<td><input type="checkbox" name="paMdu" value="√" /></td>
				<th>机盘B</th>
				<td><input type="checkbox" name="paDiskB" value="√" /></td>
				<th>机盘C</th>
				<td><input type="checkbox" name="paDiskC" value="√" /></td>
				<th>机盘D</th>
				<td><input type="checkbox" name="paDiskD" value="√" /></td>
				<th>机盘E</th>
				<td><input type="checkbox" name="paDiskE" value="√" /></td>
				<th>背板</th>
				<td><input type="checkbox" name="paBackplane" value="√" /></td>
			</tr>
			<tr>
				<th>网管软件</th>
				<td><input type="checkbox" name="paRemotescope" value="√" /></td>
				<th>结构</th>
				<td><input type="checkbox" name="paStructure" value="√" /></td>
				<th>电缆</th>
				<td><input type="checkbox" name="paCable" value="√" /></td>
				<th>电源盘</th>
				<td><input type="checkbox" name="paPowerPanel" value="√" /></td>
				<th>风扇控制单元</th>
				<td><input type="checkbox" name="paFanControlUnit" value="√" /></td>
				<th>网元管理盘</th>
				<td><input type="checkbox" name="paMmcp" value="√" /></td>
			</tr>
			<tr>


				<th>公务盘</th>
				<td><input type="checkbox" name="paOfficialDisk" value="√" /></td>
				<th>技术手册</th>
				<td><input type="checkbox" name="paTechnicalManual" value="√" /></td>
				<th>安装手册</th>
				<td><input type="checkbox" name="paInstallationManual" value="√" /></td>
				<th>网管手册</th>
				<td><input type="checkbox" name="paNetManual" value="√" /></td>
				<th>使用维护手册</th>
				<td><input type="checkbox" name="paUseManual" value="√" /></td>
				<th>用户手册</th>
				<td><input type="checkbox" name="paUserManual" value="√" /></td>
			</tr>

		</table>

		<table class="tm-tableAttr">
			<tr class="tm-tableAttrSub">
				<th colspan="14">需求设计</th>
			</tr>
			<tr>
				<th>触发条件</th>
				<td><input class="textbox" name="rdTriggerCondition"></input></td>
			</tr>
			<tr>
				<th>输入(input)</th>
				<td><input class="textbox" name="rdInput"></input></td>
			</tr>
			<tr>
				<th>处理</th>
				<td><input class="textbox" name="rdHandle"></input></td>
			</tr>
			<tr>
				<th>输出(output)</th>
				<td><input class="textbox" name="rdOutput"></input></td>
			</tr>
			<tr>
				<th>特殊需求</th>
				<td><input class="textbox" name="rdSpecialNeeds"></input></td>
			</tr>
		</table>
	</form>
	<div style="padding:5px">
		<a href="javascript:void(0)" class="button" onclick="submitForm()">提交</a>
		<a href="javascript:void(0)" class="button" onclick="clearForm()">重置</a>
	</div>
</div>
<script type="text/javascript">
	$(function(){
	});
	
function submitForm(){
	var designNo = $('#designNo').val();
	var tree = $("#needCategory");
	var text = tree.tree("getSelected").text;
	if(designNo==null || designNo.length==0) {
		$.messager.alert('提示','设计编号不能为空!');
		return;
	}
	if(designNo.length>=10) {
		$.messager.alert('提示','设计编号长度不能超过10位!');
		return;
	}
	$.get("/need/isdup",{designNo:designNo}, function(data) {
		if(data.data!=null) {
			$.messager.alert('提示','设计编号已经存在！');
			$('#designNo').val('');
			return;
		} else {
			$.post("/need/save",$("#needAddForm").serialize(), function(data){
				if(data.status==200){
					var id = data.data.id;
					var no = data.data.designNo;
					var node = $('#needCategory').tree('getSelected');
					$('#needCategory').tree("update",{
           				target : node.target,
           				designNo : data.data.designNo
           			});
					$.ajax({
						url:'/need/querybyno',
						dataType:'html',
						data:{
							id:id,
							designNo:no
						},
						success:function(data) {
							$('#need_add').empty();
							$('#need_add').append(data);
						}
					})
				}
			});
		}
	})
	
}
function clearForm(){
	$('#needAddForm').form('reset');
}
</script>

